function loadFile(path, callbackFn, async,attrobj){

		 var doc = document,
			  isCss,
			  e;

		  if (/\.css$/.test(path)) {
			isCss = true;

			// css
			e = doc.createElement('link');
			e.rel = 'stylesheet';
			e.href = path;
		  } else {
			// javascript
			e = doc.createElement('script');
			for (var prop in attrobj) {
			  if( attrobj.hasOwnProperty( prop ) && prop!="path" ) {
				  e.setAttribute(prop,attrobj[prop]);
			  } 
			}
			e.src = path;
			e.async = (async === undefined) ? true : async;
		  }

		  e.onload = e.onerror = e.onbeforeload = function(ev) {
			var result = ev.type[0];

			// Note: The following code isolates IE using `hideFocus` and treats empty
			// stylesheets as failures to get around lack of onerror support
			if (isCss && 'hideFocus' in e) {
			  try {
				if (!e.sheet.cssText.length) result = 'e';
			  } catch (x) {
				// sheets objects created from load errors don't allow access to
				// `cssText`
				result = 'e';
			  }
			}

			// execute callback
			callbackFn(path, result, ev.defaultPrevented);  
		 };
		 if(isCss){
			  doc.head.appendChild(e);
		 }else{
			 doc.body.appendChild(e);
		 }
		 
}
module.exports = loadFile